package com.inspur.edp.ai.flow.api;

import com.fasterxml.jackson.databind.node.ArrayNode;

import java.util.List;
import java.util.Map;

/**
 * 流程调用API
 *
 * @author lizhaorui
 * @date 2025/8/15
 * @description
 */
public interface FlowInvokeService {

    /**
     * 调用流程
     *
     * @param flowId 流程Id
     * @param args   参数列表
     * @return 流程执行结果
     */
    Map<String, Object> invoke(String flowId, List<Object> args);


    Map<String, Object> invoke(String flowId, Map<String, Object> argMap);


    <T> T invokeWithOneReturnValue(String flowId, Map<String, Object> argMap, Class<T> cls);


    /**
     * 异步调用流程
     *
     * @param flowId         流程Id
     * @param flowInstanceId 流程实例Id
     * @param args           输入参数
     * @return
     */

    FlowResponse asyncInvoke(String flowId, String flowInstanceId, List<Object> args);


    /**
     * 流式输出
     *
     * @param flowId         流程Id
     * @param flowInstanceId 流程实例Id
     * @param args           输入参数
     * @return
     */
    FlowResponse stream(String flowId, String flowInstanceId, List<Object> args);

    FlowResponse stream(String flowId, String flowInstanceId, Map<String, Object> args);

    /**
     * 获取中断的节点列表
     *
     * @param flowId
     * @param flowInstanceId
     * @return
     */
    List<String> getSuspendNodes(String flowId, String flowInstanceId);

}
